package xfuzzy.xfhl.view;

import javax.swing.ButtonGroup;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.BorderFactory;
import javax.swing.border.TitledBorder;
import java.awt.Font;
import java.awt.Color;
import javax.swing.JTextField;
import xfuzzy.util.XConstants;
import xfuzzy.util.XDialog;
import xfuzzy.util.XFileChooser;
import xfuzzy.util.XFileFilter;
import xfuzzy.xfedit.XfeditIcons;
import xfuzzy.xfhl.model.XfhlConfig;
import xfuzzy.xfhl.model.spec.XfhlInputType;
import xfuzzy.xfhl.model.spec.XfhlOperSet;
import java.awt.GridBagConstraints;
import java.awt.Point;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import javax.swing.JRadioButton;
import javax.swing.SwingConstants;
import javax.swing.JButton;

/**
 * Clase que encapsula la vista de un objeto XfhlConfig, es la ventana que
 * representa la configuracion de la herramienta XFHL
 * 
 * @author Sergio Cala Cordero, Septiembre 2009, Herramienta XFHL
 * 
 */
public class XfhlConfigView extends JFrame {

	private static final long serialVersionUID = 1L;

	/**
	 * Contenedor principal
	 */
	private JPanel jContentPane = null;

	/**
	 * Contenedor del nombre el dataSet y el N�mero de hebras
	 */
	private JPanel jPnlSystem = null;

	/**
	 * Nombre del sistema
	 */
	private JTextField jTxtFldNameSystem = null;
	private JLabel jLabelName = null;

	/**
	 * DataSet
	 */
	private JTextField jTxtFldDataSet = null;
	private JLabel jLblDataSet = null;

	/**
	 * Numero de hebras que utilizaremos
	 */
	private JLabel jLblNumThread = null;
	private JTextField jTxtFldNumThread = null;

	/**
	 * Contenedor con los parametros del algoritmo
	 */
	private JPanel jPnlAlgorithm = null;

	/**
	 * Contenedor de los par�metros del algoritmo
	 */
	private JPanel jPnlParam = null;

	/**
	 * Algoritmo RProp
	 */
	private JRadioButton jRBRprop = null;

	/**
	 * Algoritmo Mardquardt Levenberg
	 */
	private JRadioButton jRBMarLev = null;

	/**
	 * ButtonGroup Algoritmo
	 */
	private ButtonGroup jBGrAlg = null; // @jve:decl-index=0:

	/**
	 * Algoritmo seleccionado
	 */
	private int AlgSelected = -1;

	/**
	 * Parametro Initial Update
	 */
	private JLabel jLblIniUpd = null;
	private JTextField jTxtFldUpd = null;

	/**
	 * Parametro Increase Factor
	 */
	private JLabel jLblIncFact = null;
	private JTextField jTxtFldIncFactor = null;

	/**
	 * Parametro Decrease Factor
	 */
	private JLabel jLblDecFact = null;
	private JTextField jTxtFldDecFactor = null;

	/**
	 * Contenedor con el limite de iteraciones
	 */
	private JPanel jPnlEndCondition = null;

	/**
	 * Limite de iteraciones
	 */
	private JLabel jLblLimitonIter = null;
	private JTextField jTxtFldLimitonIter = null;

	/**
	 * Contenedor de los Operadores
	 */
	private JPanel jPnlOperSet = null;

	/**
	 * Contenedor del Operador And
	 */
	private JPanel jPnlOperAnd = null;

	/**
	 * ButtonGroup Operador And
	 */
	private ButtonGroup jBGrOperAnd = null;

	/**
	 * RadioButton funcion Minimo
	 */
	private JRadioButton jRBttnAndMin = null;

	/**
	 * RadioButton funcion Producto
	 */
	private JRadioButton jRBttnAndProd = null;

	/**
	 * Contenedor del Operador de defuzificacion
	 */
	private JPanel jPnlOperDefuz = null;

	/**
	 * RadioButton Funcion Weigthed Fuzzy Mean
	 */
	private JRadioButton jRBttnDefWeig = null;

	/**
	 * ButtonGroup Operador de defuzificacion
	 */
	private ButtonGroup jBGrOperDef = null; // @jve:decl-index=0:

	/**
	 * RadioButton Funcion Fuzzy Mean
	 */
	private JRadioButton jRBttnDefFuzzyMean = null;

	/**
	 * Contenedor del estilo del tipo de entrada
	 */
	private JPanel jPnlInType = null;

	/**
	 * Numero de funciones de entrada
	 */
	private JLabel jLblNoMemberFuntion = null;
	private JTextField jTxtFldNoMemberFuntion = null;

	/**
	 * Boton de Free Triangles
	 */
	private JButton jBtnFreeTri = null;

	/**
	 * Boton de Triangles Family
	 */
	private JButton jBtnTriFam = null;

	/**
	 * Boton Free Shouldered Triangles
	 */
	private JButton jBtnFreeShoulTri = null;

	/**
	 * Boton Shouldered-Triangular Family
	 */
	private JButton jBtnShoulTriFam = null;

	/**
	 * Bot�n Free Gaussians
	 */
	private JButton jBtnFreeGau = null;

	/**
	 * Bot�n B-Splines Family
	 */
	private JButton jBtnB_SplinesFam = null;

	/**
	 * Objeto que contendr�la configuraci�n de la herramienta
	 */
	private XfhlConfig xfhlConfig = null;

	/**
	 * Para saber que boton del tipo de entrada esta activado
	 */
	private JButton jBtnInTypeSelected = null;

	/**
	 * Tipo de entrada seleccionado
	 */
	private int IN_TYPE = -1;

	/**
	 * Operador AND seleccionado
	 */
	private int operatorAND;

	/**
	 * Operador de Defuzificaci�n seleccionado
	 */
	private int defuzzOperator;

	/**
	 * Instancia a la ventana principal de l herramienta
	 */
	private XfhlView xfhlView = null;

	/**
	 * Button Aceptar
	 */
	private JButton jBtnAceptar = null;

	/**
	 * Button Cancelar
	 */
	private JButton jBtnCancel = null;

	/**
	 * Metodo que restaura el borde del boton anteriormente seleccionado
	 */
	private void restartBorder(JButton jbntSelect) {
		if (jBtnInTypeSelected != null && this.jBtnInTypeSelected != jbntSelect) {
			jBtnInTypeSelected.setBorder(BorderFactory.createRaisedBevelBorder());
		}
	}

	/**
	 * Genera la configuracion de la herramienta con los datos CORRECTOS del
	 * formulario
	 */
	private XfhlConfig createXfhlConfig() {
		String nameSystem = this.jTxtFldNameSystem.getText();
		int numIterAjus = Integer.parseInt(this.jTxtFldLimitonIter.getText());
		int numThreads;

		if (this.jTxtFldNumThread.getText().compareTo("default") == 0)
			numThreads = -1;
		else
			numThreads = Integer.parseInt(this.jTxtFldNumThread.getText());

		File file = new File(this.jTxtFldDataSet.getText());
		double iniUpd = Double.parseDouble(this.jTxtFldUpd.getText());
		double incFact = Double.parseDouble(this.jTxtFldIncFactor.getText());
		double decFact = Double.parseDouble(this.jTxtFldDecFactor.getText());
		int mfs = Integer.parseInt(this.jTxtFldNoMemberFuntion.getText());

		this.xfhlConfig = new XfhlConfig(nameSystem, numIterAjus, numThreads, file, iniUpd, incFact, decFact, 
				this.operatorAND, this.defuzzOperator, this.IN_TYPE, mfs, this.AlgSelected);
		return this.xfhlConfig;

	}

	/**
	 * Metodo que comprueba que todos los campos estan correctamente introducido
	 * 
	 * @return true-> formulario correcto, false-> formulario incorrecto
	 */
	private boolean validateForm() {
		String message = "";
		boolean salida = true;
		int value = 0;

		// Tenemos que comprobar todos los campos

		// Nombre del sistema
		if (this.jTxtFldNameSystem.getText().compareTo("") == 0) {
			message += "The system name is required.\n";
		}

		// Ruta del archivo dataSet
		if (this.jTxtFldDataSet.getText().compareTo("") == 0) {
			message += "The data set file is required.\n";
		}

		boolean isInteger = true;
		// Numero de hebras
		try {
			if (jTxtFldNumThread.getText().compareTo("default") != 0)
				value = Integer.parseInt(jTxtFldNumThread.getText());
			else
				value = 1;
		} catch (Exception e) {
			isInteger = false;
		}

		if (!isInteger || value <= 0) {
			message += "The threads number is required.\n";
		}

		isInteger = true;
		// Numero de funciones de pertenencia
		try {
			value = Integer.parseInt(jTxtFldNoMemberFuntion.getText());
		} catch (Exception e) {
			isInteger = false;
		}

		if (!isInteger || value <= 0) {
			message += "The No. Men. Funtions is required.\n";
		}

		// Tipo de funciones de entrada
		if (this.IN_TYPE == -1) {
			message += "The in type is required.\n";
		}

		/* ALGORITMO */

		// Eleccion del algoritmo
		if (this.AlgSelected == -1) {
			message += "The algorithm has not been selected.\n";
		}

		// Initial update
		boolean isDouble = true;
		try {
			Double.parseDouble(jTxtFldUpd.getText());
		} catch (Exception e) {
			isDouble = false;
		}
		if (!isDouble) {
			message += "The paremeter 'Initial update' is required.\n";
		}
		// Increase factor
		isDouble = true;
		try {
			Double.parseDouble(jTxtFldIncFactor.getText());
		} catch (Exception e) {
			isDouble = false;
		}
		if (!isDouble) {
			message += "The paremeter 'Increase factor' is required.\n";
		}
		// Decrease factor
		isDouble = true;
		try {
			Double.parseDouble(jTxtFldDecFactor.getText());
		} catch (Exception e) {
			isDouble = false;
		}
		if (!isDouble) {
			message += "The paremeter 'Decrease factor' is required.\n";
		}

		// N�mero de iteraciones
		isInteger = true;
		try {
			value = Integer.parseInt(jTxtFldLimitonIter.getText());
		} catch (Exception e) {
			isInteger = false;
		}

		if (!isInteger || value <= 0) {
			message += "The No. Iterations is required.\n";
		}
		// Operator AND
		if (jBGrOperAnd.getSelection() == null) {
			message += "The AND operator is required.\n";
		}
		// Operator DEFUZ
		if (jBGrOperDef.getSelection() == null) {
			message += "The DEFUZ operator is required.\n";
		}

		if (message.compareTo("") != 0) {
			salida = false;
			JOptionPane.showMessageDialog(this, message, "ERROR", JOptionPane.ERROR_MESSAGE);
		}

		return salida;
	}

	/**
	 * Constructor
	 * 
	 * @param xfhlView
	 *            Instancia a la herramienta principal de la herramienta Xfhl
	 */
	public XfhlConfigView(XfhlView xfhlView) {
		super();
		this.xfhlView = xfhlView;
		this.xfhlConfig = null;
		initialize();
		inicializeForm();

	}

	/**
	 * Metodo que inicializa el formulario con los valores por defecto
	 */
	public void inicializeForm() {
		// El nombre del sistema
		this.jTxtFldNameSystem.setText(this.xfhlView.getOriginalSpec().getName());
		// Inicializamos el valor al numero de procesadores
		this.jTxtFldNumThread.setText("default");
		// Numero de funciones de pertencia
		this.jTxtFldNoMemberFuntion.setText("3");
		// Estilo de entrada
		this.jBtnFreeTri.setBorder(BorderFactory.createLoweredBevelBorder());
		this.IN_TYPE = XfhlInputType.FREE_TRIANGLES;
		restartBorder(jBtnFreeTri);
		this.jBtnInTypeSelected = jBtnFreeTri;
		// Algoritmo
		this.setAlgorithm(0);
		this.jRBRprop.setSelected(true);
		this.jTxtFldLimitonIter.setText("40");
		// Operator set
		operatorAND = XfhlOperSet.AndOperatorMin;
		jRBttnAndMin.setSelected(true);
		defuzzOperator = XfhlOperSet.DefuzOperatorFuzzyMean;
		jRBttnDefFuzzyMean.setSelected(true);
	}

	/**
	 * Constructor que carga los datos del objeto xfhlConfig en la ventana de
	 * configuracion
	 * 
	 * @param xfhlView
	 *            Instancia a la herramienta principal de la herramienta Xfhl
	 * @param xfhlConfig
	 *            Objeto de configuracion de la herramienta
	 */
	public XfhlConfigView(XfhlView xfhlView, XfhlConfig xfhlConfig) {
		super();
		initialize();
		this.xfhlView = xfhlView;
		this.xfhlConfig = xfhlConfig;

		this.jTxtFldNumThread.setText(String.valueOf(xfhlConfig.getNumThread()));

		this.jTxtFldNameSystem.setText(xfhlConfig.getNameSystem());
		this.jTxtFldLimitonIter.setText(String.valueOf(xfhlConfig.getnumIterAjust()));
		if (xfhlConfig.getValueThread() != -1)
			this.jTxtFldNumThread.setText(String.valueOf(xfhlConfig.getNumThread()));
		else
			this.jTxtFldNumThread.setText("default");

		this.AlgSelected = xfhlConfig.getAlgorithm();
		if (this.AlgSelected == 0)
			this.jRBRprop.setSelected(true);
		else
			this.jRBMarLev.setSelected(true);

		this.jTxtFldDataSet.setText(xfhlConfig.getDataSetFile().getAbsolutePath());
		this.jTxtFldUpd.setText(String.valueOf(xfhlConfig.getIniUpd()));
		this.jTxtFldIncFactor.setText(String.valueOf(xfhlConfig.getIncFact()));
		this.jTxtFldDecFactor.setText(String.valueOf(xfhlConfig.getDecFact()));
		this.jTxtFldNoMemberFuntion.setText(String.valueOf(xfhlConfig.getMfs()));

		this.operatorAND = xfhlConfig.getAndOperator();

		if (XfhlOperSet.AndOperatorMin == this.operatorAND)
			jRBttnAndMin.setSelected(true);
		else if (XfhlOperSet.AndOperatorProd == this.operatorAND)
			jRBttnAndProd.setSelected(true);

		this.defuzzOperator = xfhlConfig.getDefuzOperator();

		if (XfhlOperSet.DefuzOperatorFuzzyMean == this.defuzzOperator)
			jRBttnDefFuzzyMean.setSelected(true);
		else if (XfhlOperSet.DefuzOperatorWeightedFuzzyMean == this.defuzzOperator)
			jRBttnDefWeig.setSelected(true);

		this.IN_TYPE = xfhlConfig.getStileInput();

		switch (this.IN_TYPE) {
			case XfhlInputType.FREE_TRIANGLES:
				jBtnInTypeSelected = jBtnFreeTri;
				break;
			case XfhlInputType.FREE_SHOULDERED_TRIANGLES:
				jBtnInTypeSelected = jBtnFreeShoulTri;
				break;
			case XfhlInputType.FREE_GAUSSIANS:
				jBtnInTypeSelected = jBtnFreeGau;
				break;
			case XfhlInputType.TRIANGULAR_FAMILY:
				jBtnInTypeSelected = jBtnTriFam;
				break;
			case XfhlInputType.SHOULDERED_TRIANGLES_FAMILY:
				jBtnInTypeSelected = jBtnShoulTriFam;
				break;
			case XfhlInputType.B_SPLINES_FAMILY:
				jBtnInTypeSelected = jBtnB_SplinesFam;
				break;
			default:
				break;
		}
		jBtnInTypeSelected.setBorder(BorderFactory.createLoweredBevelBorder());
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setContentPane(getJContentPane());
		this.setTitle("Xfhl Configuration");
		this.setSize(new Dimension(600, 450));
		this.setLocationRelativeTo(null);
		this.setResizable(false);
		this.setBackground(new Color(50, 50, 50));

		this.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent evt) {
				xfhlView.setEnabled(true);
				dispose();
			}
		});
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(getJPnlSystem(), null);
			jContentPane.add(getJPnlAlgorithm(), null);
			jContentPane.add(getJPnlOperSet(), null);
			jContentPane.add(getJBtnAceptar(), null);
			jContentPane.add(getJBtnCancel(), null);
			jContentPane.add(getJPnlInType(), null);
		}
		return jContentPane;
	}

	/**
	 * This method initializes jPnlSystem
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPnlSystem() {
		if (jPnlSystem == null) {
			jLblNumThread = new JLabel();
			jLblNumThread.setBounds(new Rectangle(29, 90, 79, 18));
			jLblNumThread.setText("No. Threads");
			jLblNumThread.setHorizontalAlignment(JLabel.CENTER);
			jLblNumThread.setForeground(Color.black);
			jLblNumThread.setBorder(BorderFactory.createRaisedBevelBorder());
			jLblNumThread.setFont(new Font("Dialog", Font.PLAIN, 10));
			jLblDataSet = new JLabel();
			jLblDataSet.setText("Data set");
			jLblDataSet.setSize(new Dimension(77, 18));
			jLblDataSet.setLocation(new Point(28, 62));
			jLblDataSet.setHorizontalAlignment(JLabel.CENTER);
			jLblDataSet.setForeground(Color.black);
			jLblDataSet.setBorder(BorderFactory.createRaisedBevelBorder());
			jLblDataSet.setFont(new Font("Dialog", Font.PLAIN, 10));
			jLblDataSet.addMouseListener(new java.awt.event.MouseAdapter() {
				public void mouseClicked(java.awt.event.MouseEvent e) {
					selectDataSet();
				}
			});
			jLabelName = new JLabel();
			jLabelName.setBounds(new Rectangle(27, 36, 79, 18));
			jLabelName.setHorizontalAlignment(JLabel.CENTER);
			jLabelName.setForeground(Color.black);
			jLabelName.setBorder(BorderFactory.createRaisedBevelBorder());
			jLabelName.setFont(new Font("Dialog", Font.PLAIN, 10));
			jLabelName.setText("Name");
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
			gridBagConstraints.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints.gridy = 0;
			gridBagConstraints.weightx = 1.0;
			gridBagConstraints.gridx = 0;
			jPnlSystem = new JPanel();
			jPnlSystem.setLayout(null);
			jPnlSystem.setBounds(new Rectangle(22, 16, 250, 124));
			jPnlSystem.setBorder(BorderFactory.createTitledBorder(null, "System", TitledBorder.CENTER,
					TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
			jPnlSystem.setBackground(XConstants.jpanelColorBackground);
			// jPnlSystem.setBackground(new Color(215,215,215));
			jPnlSystem.add(getJTxtFldNameSystem(), gridBagConstraints);
			jPnlSystem.add(jLabelName, null);
			jPnlSystem.add(jLblDataSet, null);
			jPnlSystem.add(getJTxtFldDataSet(), null);
			jPnlSystem.add(jLblNumThread, null);
			jPnlSystem.add(getJTxtFldNumThread(), null);
		}
		return jPnlSystem;
	}

	/**
	 * This method initializes jTxtFldNameSystem
	 * 
	 * @return javax.swing.JTextField
	 */
	private JTextField getJTxtFldNameSystem() {
		if (jTxtFldNameSystem == null) {
			jTxtFldNameSystem = new JTextField();
			jTxtFldNameSystem.setLocation(new Point(105, 36));
			jTxtFldNameSystem.setSize(new Dimension(121, 18));
			jTxtFldNameSystem.setBackground(XConstants.textbackground);
			jTxtFldNameSystem.setFont(XConstants.font);
			jTxtFldNameSystem.setEditable(false);
			jTxtFldNameSystem.setBorder(BorderFactory.createLoweredBevelBorder());
		}
		return jTxtFldNameSystem;
	}

	/**
	 * This method initializes jTxtFldDataSet
	 * 
	 * @return javax.swing.JTextField
	 */
	private JTextField getJTxtFldDataSet() {
		if (jTxtFldDataSet == null) {
			jTxtFldDataSet = new JTextField();
			jTxtFldDataSet.setSize(new Dimension(122, 18));
			jTxtFldDataSet.setBackground(XConstants.textbackground);
			jTxtFldDataSet.setLocation(new Point(104, 63));
			jTxtFldDataSet.setFont(XConstants.font);
			jTxtFldDataSet.setBorder(BorderFactory.createLoweredBevelBorder());
			jTxtFldDataSet.setEditable(false);
			jTxtFldDataSet.addMouseListener(new java.awt.event.MouseAdapter() {
				public void mouseClicked(java.awt.event.MouseEvent e) {
					selectDataSet();
				}
			});
		}
		return jTxtFldDataSet;
	}

	/**
	 * Evento para seleccionar el dataSet
	 */
	private void selectDataSet() {
		boolean exist = false;
		do {
			XFileChooser fileDataSet = new XFileChooser(new File(""), XFileChooser.SELECT);
			fileDataSet.addFileFilter(new XFileFilter(".dat", "Data Set"));

			int sal = fileDataSet.showDialog();

			if (sal == XFileChooser.CANCELED) {
				exist = true;
			} else if (fileDataSet.getSelectedFile() != null) {
				File file = new File(fileDataSet.getSelectedFile().getPath());

				if (file.exists() && file.isFile()) {
					exist = true;
					jTxtFldDataSet.setText(fileDataSet.getSelectedFile().getPath());
				} else {
					XDialog.showMessage(null, "The data set file must exist.");
				}
			}
		} while (!exist);
	}

	/**
	 * 
	 * @param i
	 *            0-> RProp 1-> Marquardt Levenberg
	 */
	private void setAlgorithm(int i) {
		this.AlgSelected = i;
		String ini = "";
		String iniV = "";
		String incFacV = "";
		String decFacV = "";

		if (i == 0) {
			ini = "Initial update";
			iniV = "0.1";
			incFacV = "1.5";
			decFacV = "0.7";
		} else {
			ini = "Ini. Hessian Addition";
			iniV = "1";
			incFacV = "10";
			decFacV = "0.1";
		}
		this.jLblIniUpd.setText(ini);
		this.jTxtFldUpd.setText(iniV);
		this.jTxtFldIncFactor.setText(incFacV);
		this.jTxtFldDecFactor.setText(decFacV);
	}

	/**
	 * This method initializes jPnlAlgorithm
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPnlAlgorithm() {
		if (jPnlAlgorithm == null) {
			jLblDecFact = new JLabel();
			jLblDecFact.setText("Decrease factor");
			jLblDecFact.setFont(new Font("Dialog", Font.PLAIN, 10));
			jLblDecFact.setBounds(new Rectangle(9, 67, 97, 16));
			jLblDecFact.setBorder(BorderFactory.createRaisedBevelBorder());
			jLblIncFact = new JLabel();
			jLblIncFact.setText("Increase factor");
			jLblIncFact.setFont(new Font("Dialog", Font.PLAIN, 10));
			jLblIncFact.setBounds(new Rectangle(8, 45, 98, 16));
			jLblIncFact.setBorder(BorderFactory.createRaisedBevelBorder());
			jLblIniUpd = new JLabel();
			jLblIniUpd.setText("Initial update");
			jLblIniUpd.setFont(new Font("Dialog", Font.PLAIN, 10));
			jLblIniUpd.setBounds(new Rectangle(9, 23, 98, 16));
			jLblIniUpd.setBorder(BorderFactory.createRaisedBevelBorder());
			jPnlAlgorithm = new JPanel();
			jPnlAlgorithm.setLayout(null);
			jPnlAlgorithm.setBounds(new Rectangle(301, 16, 265, 218));
			jPnlAlgorithm.setBorder(BorderFactory.createTitledBorder(null, "Algorithm", TitledBorder.CENTER,
					TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
			jPnlAlgorithm.setBackground(XConstants.jpanelColorBackground);
			jPnlAlgorithm.add(getJPnlParam(), null);
			jPnlAlgorithm.add(getJPnlEndCondition(), null);
			jPnlAlgorithm.add(getJRBRprop(), null);
			jPnlAlgorithm.add(getJRBMarLev(), null);

			jBGrAlg = new ButtonGroup();
			jBGrAlg.add(jRBRprop);
			jBGrAlg.add(jRBMarLev);
		}
		return jPnlAlgorithm;
	}

	/**
	 * This method initializes jTxtFldUpd
	 * 
	 * @return javax.swing.JTextField
	 */
	private JTextField getJTxtFldUpd() {
		if (jTxtFldUpd == null) {
			jTxtFldUpd = new JTextField();
			jTxtFldUpd.setFont(XConstants.font);
			jTxtFldUpd.setBounds(new Rectangle(107, 22, 121, 18));
			jTxtFldUpd.setBackground(XConstants.textbackground);
			jTxtFldUpd.setBorder(BorderFactory.createLoweredBevelBorder());
		}
		return jTxtFldUpd;
	}

	/**
	 * This method initializes jPnlParam
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPnlParam() {
		if (jPnlParam == null) {
			jPnlParam = new JPanel();
			jPnlParam.setLayout(null);
			jPnlParam.setBounds(new Rectangle(13, 58, 239, 87));
			jPnlParam.setBorder(BorderFactory.createTitledBorder(null, "Parameters", TitledBorder.CENTER,
					TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.PLAIN, 11), new Color(51, 51, 51)));
			jPnlParam.setBackground(XConstants.jpanelColorBackground);
			jPnlParam.add(jLblIniUpd, null);
			jPnlParam.add(getJTxtFldUpd(), null);
			jPnlParam.add(jLblIncFact, null);
			jPnlParam.add(jLblDecFact, null);
			jPnlParam.add(getJTxtFldIncFactor(), null);
			jPnlParam.add(getJTxtFldDecFactor(), null);
		}
		return jPnlParam;
	}

	/**
	 * This method initializes jPnlEndCondition
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPnlEndCondition() {
		if (jPnlEndCondition == null) {
			jLblLimitonIter = new JLabel();
			jLblLimitonIter.setBounds(new Rectangle(12, 22, 90, 16));
			jLblLimitonIter.setFont(new Font("Dialog", Font.PLAIN, 10));
			jLblLimitonIter.setText("No. Iterations");
			jLblLimitonIter.setBorder(BorderFactory.createLoweredBevelBorder());
			jPnlEndCondition = new JPanel();
			jPnlEndCondition.setLayout(null);
			jPnlEndCondition.setBounds(new Rectangle(14, 160, 238, 44));
			jPnlEndCondition.setBackground(XConstants.jpanelColorBackground);
			jPnlEndCondition.setBorder(BorderFactory.createTitledBorder(null, "End condition", TitledBorder.CENTER,
					TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.PLAIN, 11), new Color(51, 51, 51)));
			jPnlEndCondition.add(jLblLimitonIter, null);
			jPnlEndCondition.add(getJTxtFldLimitonIter(), null);
		}
		return jPnlEndCondition;
	}

	/**
	 * This method initializes jTxtFldLimitonIter
	 * 
	 * @return javax.swing.JTextField
	 */
	private JTextField getJTxtFldLimitonIter() {
		if (jTxtFldLimitonIter == null) {
			jTxtFldLimitonIter = new JTextField();
			jTxtFldLimitonIter.setBounds(new Rectangle(101, 22, 125, 17));
			jTxtFldLimitonIter.setBackground(XConstants.textbackground);
			jTxtFldLimitonIter.setFont(XConstants.font);
			jTxtFldLimitonIter.setSize(new Dimension(121, 18));
			jTxtFldLimitonIter.setBorder(BorderFactory.createLoweredBevelBorder());
		}
		return jTxtFldLimitonIter;
	}

	/**
	 * This method initializes jTxtFldIncFactor
	 * 
	 * @return javax.swing.JTextField
	 */
	private JTextField getJTxtFldIncFactor() {
		if (jTxtFldIncFactor == null) {
			jTxtFldIncFactor = new JTextField();
			jTxtFldIncFactor.setBounds(new Rectangle(106, 45, 121, 16));
			jTxtFldIncFactor.setFont(XConstants.font);
			jTxtFldIncFactor.setSize(new Dimension(121, 18));
			jTxtFldIncFactor.setBackground(XConstants.textbackground);
			jTxtFldIncFactor.setBorder(BorderFactory.createLoweredBevelBorder());
		}
		return jTxtFldIncFactor;
	}

	/**
	 * This method initializes jTxtFldDecFactor
	 * 
	 * @return javax.swing.JTextField
	 */
	private JTextField getJTxtFldDecFactor() {
		if (jTxtFldDecFactor == null) {
			jTxtFldDecFactor = new JTextField();
			jTxtFldDecFactor.setBounds(new Rectangle(106, 66, 121, 18));
			jTxtFldDecFactor.setFont(XConstants.font);
			jTxtFldDecFactor.setBackground(XConstants.textbackground);
			jTxtFldDecFactor.setBorder(BorderFactory.createLoweredBevelBorder());
		}
		return jTxtFldDecFactor;
	}

	/**
	 * This method initializes jPnlOperSet
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPnlOperSet() {
		if (jPnlOperSet == null) {
			jPnlOperSet = new JPanel();
			jPnlOperSet.setLayout(null);
			jPnlOperSet.setBounds(new Rectangle(302, 244, 263, 123));
			jPnlOperSet.setBorder(BorderFactory.createTitledBorder(null, "Operator Set", TitledBorder.CENTER,
					TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
			jPnlOperSet.setBackground(XConstants.jpanelColorBackground);
			jPnlOperSet.add(getJPnlOperDefuz(), null);
			jPnlOperSet.add(getJPnlOperAnd(), null);
		}
		return jPnlOperSet;
	}

	/**
	 * This method initializes jPnlOperAnd
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPnlOperAnd() {
		if (jPnlOperAnd == null) {
			jPnlOperAnd = new JPanel();
			jPnlOperAnd.setLayout(null);
			jPnlOperAnd.setBackground(XConstants.jpanelColorBackground);
			jPnlOperAnd.setBorder(BorderFactory.createTitledBorder(null, "AND", TitledBorder.CENTER,
					TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.PLAIN, 11), new Color(51, 51, 51)));
			jPnlOperAnd.setFont(new Font("Dialog", Font.PLAIN, 12));
			jPnlOperAnd.setBounds(new Rectangle(15, 26, 236, 39));
			jPnlOperAnd.add(getJRBttnAndMin(), null);
			jPnlOperAnd.add(getJRBttnAndProd(), null);

			jBGrOperAnd = new ButtonGroup();
			jBGrOperAnd.add(jRBttnAndMin);
			jBGrOperAnd.add(jRBttnAndProd);
		}
		return jPnlOperAnd;
	}

	/**
	 * This method initializes jPnlOperDefuz
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPnlOperDefuz() {
		if (jPnlOperDefuz == null) {
			jPnlOperDefuz = new JPanel();
			jPnlOperDefuz.setLayout(null);
			jPnlOperDefuz.setBounds(new Rectangle(15, 71, 235, 43));
			jPnlOperDefuz.setBorder(BorderFactory.createTitledBorder(null, "DEFUZ", TitledBorder.CENTER,
					TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.PLAIN, 11), new Color(51, 51, 51)));
			jPnlOperDefuz.setBackground(XConstants.jpanelColorBackground);
			jPnlOperDefuz.add(getJRBttnDefFuzzyMean(), null);
			jPnlOperDefuz.add(getJRBttnDefWeig(), null);

			jBGrOperDef = new ButtonGroup();
			jBGrOperDef.add(jRBttnDefFuzzyMean);
			jBGrOperDef.add(jRBttnDefWeig);
		}
		return jPnlOperDefuz;
	}

	/**
	 * This method initializes jRBttnAndMin
	 * 
	 * @return javax.swing.JRadioButton
	 */
	private JRadioButton getJRBttnAndMin() {
		if (jRBttnAndMin == null) {
			jRBttnAndMin = new JRadioButton();
			jRBttnAndMin.setBounds(new Rectangle(33, 12, 54, 21));
			jRBttnAndMin.setText("Min");
			jRBttnAndMin.setFont(new Font("Dialog", Font.BOLD, 10));
			jRBttnAndMin.setBackground(XConstants.jpanelColorBackground);
			jRBttnAndMin.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					operatorAND = XfhlOperSet.AndOperatorMin;
				}
			});
		}
		return jRBttnAndMin;
	}

	/**
	 * This method initializes jRBttnAndProd
	 * 
	 * @return javax.swing.JRadioButton
	 */
	private JRadioButton getJRBttnAndProd() {
		if (jRBttnAndProd == null) {
			jRBttnAndProd = new JRadioButton();
			jRBttnAndProd.setBounds(new Rectangle(139, 10, 51, 24));
			jRBttnAndProd.setText("Prod");
			jRBttnAndProd.setFont(new Font("Dialog", Font.BOLD, 10));
			jRBttnAndProd.setHorizontalTextPosition(SwingConstants.LEADING);
			jRBttnAndProd.setBackground(XConstants.jpanelColorBackground);
			jRBttnAndProd.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					operatorAND = XfhlOperSet.AndOperatorProd;
				}
			});
		}
		return jRBttnAndProd;
	}

	/**
	 * This method initializes jRBttnDefFuzzyMean
	 * 
	 * @return javax.swing.JRadioButton
	 */
	private JRadioButton getJRBttnDefFuzzyMean() {
		if (jRBttnDefFuzzyMean == null) {
			jRBttnDefFuzzyMean = new JRadioButton();
			jRBttnDefFuzzyMean.setBounds(new Rectangle(17, 12, 80, 24));
			jRBttnDefFuzzyMean.setText("FuzzyMean");
			jRBttnDefFuzzyMean.setFont(new Font("Dialog", Font.BOLD, 10));
			jRBttnDefFuzzyMean.setBackground(XConstants.jpanelColorBackground);
			jRBttnDefFuzzyMean.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					defuzzOperator = XfhlOperSet.DefuzOperatorFuzzyMean;
				}
			});
		}
		return jRBttnDefFuzzyMean;
	}

	/**
	 * This method initializes jRBttnDefWeig
	 * 
	 * @return javax.swing.JRadioButton
	 */
	private JRadioButton getJRBttnDefWeig() {
		if (jRBttnDefWeig == null) {
			jRBttnDefWeig = new JRadioButton();
			jRBttnDefWeig.setBounds(new Rectangle(100, 13, 125, 22));
			jRBttnDefWeig.setFont(new Font("Dialog", Font.BOLD, 10));
			jRBttnDefWeig.setText("WeigthedFuzzyMean");
			jRBttnDefWeig.setActionCommand("WeigthedFuzzyMean");
			jRBttnDefWeig.setHorizontalTextPosition(SwingConstants.LEADING);
			jRBttnDefWeig.setBackground(XConstants.jpanelColorBackground);
			jRBttnDefWeig.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					defuzzOperator = XfhlOperSet.DefuzOperatorWeightedFuzzyMean;
				}
			});
		}
		return jRBttnDefWeig;
	}

	/**
	 * This method initializes jBtnAceptar
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJBtnAceptar() {
		if (jBtnAceptar == null) {
			jBtnAceptar = new JButton();
			jBtnAceptar.setBounds(new Rectangle(128, 384, 149, 23));
			jBtnAceptar.setBorder(BorderFactory.createRaisedBevelBorder());
			jBtnAceptar.setFont(XConstants.font);
			jBtnAceptar.setText("OK");
			jBtnAceptar.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					if (validateForm()) {
						xfhlConfig = createXfhlConfig();
						xfhlView.setConfig(xfhlConfig);
						xfhlView.setEnabled(true);
						dispose();
					}
				}
			});
		}
		return jBtnAceptar;
	}

	/**
	 * This method initializes jBtnCancel
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJBtnCancel() {
		if (jBtnCancel == null) {
			jBtnCancel = new JButton();
			jBtnCancel.setBounds(new Rectangle(317, 383, 149, 23));
			jBtnCancel.setBorder(BorderFactory.createRaisedBevelBorder());
			jBtnCancel.setFont(XConstants.font);
			jBtnCancel.setText("CANCEL");
			jBtnCancel.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					dispose();
					xfhlView.setEnabled(true);
				}
			});
		}
		return jBtnCancel;
	}

	/**
	 * This method initializes jPnlInType
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPnlInType() {
		if (jPnlInType == null) {
			jLblNoMemberFuntion = new JLabel();
			jLblNoMemberFuntion.setBounds(new Rectangle(17, 21, 110, 17));
			jLblNoMemberFuntion.setText("No. Mem. Funtions");

			jLblNoMemberFuntion.setHorizontalAlignment(JLabel.CENTER);
			jLblNoMemberFuntion.setForeground(Color.black);
			jLblNoMemberFuntion.setFont(XConstants.font);

			jPnlInType = new JPanel();
			jPnlInType.setLayout(null);
			jPnlInType.setBounds(new Rectangle(23, 158, 249, 210));
			jPnlInType.setBorder(BorderFactory.createTitledBorder(null, "INPUT TYPE", TitledBorder.CENTER,
					TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
			jPnlInType.setBackground(XConstants.jpanelColorBackground);
			jPnlInType.add(jLblNoMemberFuntion, null);
			jPnlInType.add(getJTxtFldNoMemberFuntion(), null);
			jPnlInType.add(getJBtnFreeTri(), null);
			jPnlInType.add(getJBtnTriFam(), null);
			jPnlInType.add(getJBtnFreeShoulTri(), null);
			jPnlInType.add(getJBtnShoulTriFam(), null);
			jPnlInType.add(getJBtnFreeGau(), null);
			jPnlInType.add(getJBtnB_SplinesFam(), null);
		}
		return jPnlInType;
	}

	/**
	 * This method initializes jTxtFldNoMemberFuntion
	 * 
	 * @return javax.swing.JTextField
	 */
	private JTextField getJTxtFldNoMemberFuntion() {
		if (jTxtFldNoMemberFuntion == null) {
			jTxtFldNoMemberFuntion = new JTextField();
			jTxtFldNoMemberFuntion.setBounds(new Rectangle(126, 21, 103, 18));
			jTxtFldNoMemberFuntion.setFont(XConstants.font);
			jTxtFldNoMemberFuntion.setBackground(XConstants.textbackground);
			jTxtFldNoMemberFuntion.setBorder(BorderFactory.createLoweredBevelBorder());

		}
		return jTxtFldNoMemberFuntion;
	}

	/**
	 * This method initializes jBtnFreeTri
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJBtnFreeTri() {
		if (jBtnFreeTri == null) {
			jBtnFreeTri = new JButton();
			jBtnFreeTri.setBounds(new Rectangle(30, 49, 95, 46));
			jBtnFreeTri.setBackground(new Color(238, 238, 238));
			jBtnFreeTri.setIcon(XfeditIcons.type1);
			jBtnFreeTri.setBorder(BorderFactory.createRaisedBevelBorder());
			jBtnFreeTri.setHorizontalAlignment(SwingConstants.CENTER);
			jBtnFreeTri.setFont(XConstants.font);
			jBtnFreeTri.setFocusPainted(false);
			jBtnFreeTri.setHorizontalTextPosition(SwingConstants.CENTER);
			jBtnFreeTri.setToolTipText("Free Triangles");
			jBtnFreeTri.setContentAreaFilled(false);
			jBtnFreeTri.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					jBtnFreeTri.setBorder(BorderFactory.createLoweredBevelBorder());
					IN_TYPE = XfhlInputType.FREE_TRIANGLES;
					restartBorder(jBtnFreeTri);
					jBtnInTypeSelected = jBtnFreeTri;
				}
			});

		}
		return jBtnFreeTri;
	}

	/**
	 * This method initializes jBtnTriFam
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJBtnTriFam() {
		if (jBtnTriFam == null) {
			jBtnTriFam = new JButton();
			jBtnTriFam.setBounds(new Rectangle(125, 49, 95, 46));
			jBtnTriFam.setFont(XConstants.font);
			jBtnTriFam.setBorder(BorderFactory.createRaisedBevelBorder());
			jBtnTriFam.setToolTipText("Triangles Family");
			jBtnTriFam.setContentAreaFilled(false);
			jBtnTriFam.setFocusPainted(false);
			jBtnTriFam.setHorizontalAlignment(SwingConstants.CENTER);
			jBtnTriFam.setHorizontalTextPosition(SwingConstants.CENTER);
			jBtnTriFam.setIcon(XfeditIcons.typeF1);
			jBtnTriFam.setBackground(new Color(238, 238, 238));
			jBtnTriFam.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					jBtnTriFam.setBorder(BorderFactory.createLoweredBevelBorder());
					IN_TYPE = XfhlInputType.TRIANGULAR_FAMILY;
					restartBorder(jBtnTriFam);
					jBtnInTypeSelected = jBtnTriFam;
				}
			});
		}
		return jBtnTriFam;
	}

	/**
	 * This method initializes jBtnFreeShoulTri
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJBtnFreeShoulTri() {
		if (jBtnFreeShoulTri == null) {
			jBtnFreeShoulTri = new JButton();
			jBtnFreeShoulTri.setBounds(new Rectangle(30, 95, 95, 46));
			jBtnFreeShoulTri.setFont(XConstants.font);
			jBtnFreeShoulTri.setBorder(BorderFactory.createRaisedBevelBorder());
			jBtnFreeShoulTri.setToolTipText("Free Shouldered Triangles");
			jBtnFreeShoulTri.setContentAreaFilled(false);
			jBtnFreeShoulTri.setFocusPainted(false);
			jBtnFreeShoulTri.setHorizontalAlignment(SwingConstants.CENTER);
			jBtnFreeShoulTri.setHorizontalTextPosition(SwingConstants.CENTER);
			jBtnFreeShoulTri.setIcon(XfeditIcons.type2);
			jBtnFreeShoulTri.setBackground(new Color(238, 238, 238));
			jBtnFreeShoulTri.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					jBtnFreeShoulTri.setBorder(BorderFactory.createLoweredBevelBorder());
					IN_TYPE = XfhlInputType.FREE_SHOULDERED_TRIANGLES;
					restartBorder(jBtnFreeShoulTri);
					jBtnInTypeSelected = jBtnFreeShoulTri;

				}
			});
		}
		return jBtnFreeShoulTri;
	}

	/**
	 * This method initializes jBtnShoulTriFam
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJBtnShoulTriFam() {
		if (jBtnShoulTriFam == null) {
			jBtnShoulTriFam = new JButton();
			jBtnShoulTriFam.setBounds(new Rectangle(125, 95, 95, 46));
			jBtnShoulTriFam.setFont(XConstants.font);
			jBtnShoulTriFam.setBorder(BorderFactory.createRaisedBevelBorder());
			jBtnShoulTriFam.setToolTipText("Shouldered-Triangular Family");
			jBtnShoulTriFam.setContentAreaFilled(false);
			jBtnShoulTriFam.setFocusPainted(false);
			jBtnShoulTriFam.setHorizontalAlignment(SwingConstants.CENTER);
			jBtnShoulTriFam.setHorizontalTextPosition(SwingConstants.CENTER);
			jBtnShoulTriFam.setIcon(XfeditIcons.typeF3);
			jBtnShoulTriFam.setBackground(new Color(238, 238, 238));
			jBtnShoulTriFam.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					jBtnShoulTriFam.setBorder(BorderFactory.createLoweredBevelBorder());
					IN_TYPE = XfhlInputType.SHOULDERED_TRIANGLES_FAMILY;
					restartBorder(jBtnShoulTriFam);
					jBtnInTypeSelected = jBtnShoulTriFam;
				}
			});
		}
		return jBtnShoulTriFam;
	}

	/**
	 * This method initializes jBtnFreeGau
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJBtnFreeGau() {
		if (jBtnFreeGau == null) {
			jBtnFreeGau = new JButton();
			jBtnFreeGau.setBounds(new Rectangle(30, 141, 95, 46));
			jBtnFreeGau.setFont(XConstants.font);
			jBtnFreeGau.setBorder(BorderFactory.createRaisedBevelBorder());
			jBtnFreeGau.setToolTipText("Free Gaussians");
			jBtnFreeGau.setContentAreaFilled(false);
			jBtnFreeGau.setFocusPainted(false);
			jBtnFreeGau.setHorizontalAlignment(SwingConstants.CENTER);
			jBtnFreeGau.setHorizontalTextPosition(SwingConstants.CENTER);
			jBtnFreeGau.setIcon(XfeditIcons.type3);
			jBtnFreeGau.setBackground(new Color(238, 238, 238));
			jBtnFreeGau.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					jBtnFreeGau.setBorder(BorderFactory.createLoweredBevelBorder());
					IN_TYPE = XfhlInputType.FREE_GAUSSIANS;
					restartBorder(jBtnFreeGau);
					jBtnInTypeSelected = jBtnFreeGau;
				}
			});
		}
		return jBtnFreeGau;
	}

	/**
	 * This method initializes jBtnB_SplinesFam
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJBtnB_SplinesFam() {
		if (jBtnB_SplinesFam == null) {
			jBtnB_SplinesFam = new JButton();
			jBtnB_SplinesFam.setBounds(new Rectangle(125, 141, 95, 46));
			jBtnB_SplinesFam.setFont(XConstants.font);
			jBtnB_SplinesFam.setBorder(BorderFactory.createRaisedBevelBorder());
			jBtnB_SplinesFam.setToolTipText("B-Splines Family");
			jBtnB_SplinesFam.setContentAreaFilled(false);
			jBtnB_SplinesFam.setFocusPainted(false);
			jBtnB_SplinesFam.setHorizontalAlignment(SwingConstants.CENTER);
			jBtnB_SplinesFam.setHorizontalTextPosition(SwingConstants.CENTER);
			jBtnB_SplinesFam.setIcon(XfeditIcons.typeF2);
			jBtnB_SplinesFam.setBackground(new Color(238, 238, 238));
			jBtnB_SplinesFam.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					jBtnB_SplinesFam.setBorder(BorderFactory.createLoweredBevelBorder());
					IN_TYPE = XfhlInputType.B_SPLINES_FAMILY;
					restartBorder(jBtnB_SplinesFam);
					jBtnInTypeSelected = jBtnB_SplinesFam;
				}
			});
		}
		return jBtnB_SplinesFam;
	}

	/**
	 * This method initializes jTxtFldNumThread
	 * 
	 * @return javax.swing.JTextField
	 */
	private JTextField getJTxtFldNumThread() {
		if (jTxtFldNumThread == null) {
			jTxtFldNumThread = new JTextField();
			jTxtFldNumThread.setBounds(new Rectangle(107, 90, 118, 19));
			jTxtFldNumThread.setFont(XConstants.font);
			jTxtFldNumThread.setBackground(XConstants.textbackground);
			jTxtFldNumThread.setBorder(BorderFactory.createLoweredBevelBorder());
		}
		return jTxtFldNumThread;
	}

	/**
	 * This method initializes jRBRprop
	 * 
	 * @return javax.swing.JRadioButton
	 */
	private JRadioButton getJRBRprop() {
		if (jRBRprop == null) {
			jRBRprop = new JRadioButton();
			jRBRprop.setBounds(new Rectangle(18, 29, 68, 21));
			jRBRprop.setText("RProp");
			jRBRprop.setFont(new Font("Dialog", Font.PLAIN, 10));
			jRBRprop.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					setAlgorithm(0);
				}
			});
		}
		return jRBRprop;
	}

	/**
	 * This method initializes jRBMarLev
	 * 
	 * @return javax.swing.JRadioButton
	 */
	private JRadioButton getJRBMarLev() {
		if (jRBMarLev == null) {
			jRBMarLev = new JRadioButton();
			jRBMarLev.setBounds(new Rectangle(114, 29, 138, 21));
			jRBMarLev.setToolTipText("Mardquardt Levenberg");
			jRBMarLev.setHorizontalTextPosition(SwingConstants.LEADING);
			jRBMarLev.setText("Mardquardt Levenberg");
			jRBMarLev.setFont(new Font("Dialog", Font.PLAIN, 10));
			jRBMarLev.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					setAlgorithm(1);
				}
			});

		}
		return jRBMarLev;
	}
}
